<template>
  <div id="order-list-item">
    <div class="order_no_row">
      <div class="order_no_text">订单编号</div>
      <div class="order_no_value">{{ item.no }}</div>
    </div>
    <div class="order_price_row">
      <div class="order_price_text">订单价格</div>
      <div class="order_price_value">￥{{ item.price }}</div>
    </div>
    <div class="order_time_row">
      <div class="order_time_text">订单日期</div>
      <div class="order_time_value">{{ item.create_time }}</div>
    </div>
    <div class="order_name_row">
      <div class="order_name_text">商品名称</div>
      <div class="order_name_value">{{ item.name }}</div>
    </div>
    <div class="order_count_row">
      <div class="order_count_text">商品数量</div>
      <div class="order_count_value">{{ item.count }}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "OrderListItem",
  props: {
    // 接收父组件传来的订单
    item: {
      type: Object,
      default() {
        return {};
      },
    },
  },
};
</script>

<style scoped>
#order-list-item {
  padding: 10px;
  border-bottom: 1px solid #ccc;
  color: #666;
}

.order_no_row {
  display: flex;
  padding: 5px;
  justify-content: space-between;
}

.order_price_row,
.order_name_row,
.order_count_row {
  display: flex;
  padding: 5px;
  justify-content: space-between;
}

.order_price_value {
  color: red;
  font-size: 20px;
}

.order_time_row {
  display: flex;
  padding: 5px;
  justify-content: space-between;
}
.order_name_value {
  flex: 1;
}
.order_name_value {
  margin-left: 40px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
</style>